{include file="public/head"/}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">编辑模型</div>
                <div class="layui-card-body" pad15>
                    <div class="layui-form" wid100 lay-filter="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">模型名称</label>
                            <div class="layui-input-inline">
                                <input type="text" name="title" lay-verify="required" value="{$info.title|default=''}" placeholder="请输入模型名称" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">表名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="name" lay-verify="required" value="{$info.name|default=''}" placeholder="请输入表名" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">列表页字段</label>
                            <div class="layui-input-inline">
                                <input type="text" name="listfields"  lay-verify="required" value="{$info.listfields|default=''}" placeholder="请设置列表页字段" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">
                               设置列表页查询字段
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">详述</label>
                            <div class="layui-input-block">
                                <textarea type="text" name="description" lay-verify="required" placeholder="请输入模型详述" class="layui-textarea">{$info.description|default=''}</textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <input type="hidden" value="{$info.id|default=''}" name="id">
                                <button class="layui-btn" lay-submit lay-filter="edit-but">确认保存</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/foot"/}
<script>
    layui.config({
        base: '__LAYDMIN__/',{if config('app.app_debug')}version: true{/if}
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','table','form'],function(){
		
		var $ = layui.$, admin = layui.admin, table = layui.table, element = layui.element,form = layui.form;
			//编辑提交
			var uri="{if isset($id)}{:url(SYS_PATH.'/'.CONTROLLER.'/edit')}{else}{:url(SYS_PATH.'/'.CONTROLLER.'/add')}{/if}";
			form.on('submit(edit-but)', function(data){
				admin.req({
					url: uri //实际使用请改成服务端真实接口
					, type: 'post'
					, data: data.field
					, done: function (res) {
						window.top.layer.msg(res.msg, {icon: 1, time: 1000,shade:[0.5,'#000']}, function () {
							layer.closeAll("iframe");
							//刷新父页面
							parent.location.reload();
						});
					}
				});
			});
	});
</script>
</body>
</html>